//
//  MHGameCell.m
//  MHO
//
//  Created by papo on 2/17/14.
//  Copyright (c) 2014 maihoang. All rights reserved.
//

#import "MHGameCell.h"
#import "Lib.h"

@implementation MHGameCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
    }
    return self;
}


- (void)awakeFromNib {
    self.appIcon.layer.cornerRadius = 10;
    self.appIcon.layer.masksToBounds = YES;
    self.rateView = [MHRateView rateViewFromNib];
    CGRect frame = self.rateView.frame;
    [self.rateView setFrame:CGRectMake(99, 20, frame.size.width, frame.size.height)];
    [self.contentView addSubview:self.rateView];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setApp:(Application *)app {
    _app = app;
    
    [self.appIcon setImageWithURL:[Contants getImageUrl:app.imagePath width:100 height:100]];
    self.appName.text = app.appName;
    self.appDesc.text = app.detail;
    [self.rateView setRateInt:app.rate];
    self.appSize.text = [NSString stringWithFormat:@"%@", app.size];
}


+ (MHGameCell*)cellFromNib {
    return [[[NSBundle mainBundle] loadNibNamed:@"MHGameCell" owner:self options:nil] objectAtIndex:0];
}
@end
